home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / thesrc10.zip / ERROR.C < prev    next >
C/C++ Source or Header  |  1992-08-04  |  5KB  |  178 lines

  1. /***********************************************************************/
  2. /* ERROR.C - Function to display error messages.                       */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991,1992 Mark Hessling
  7.  * 
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  * 
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  * 
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  * 
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  * 
  25.  * 
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed 
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                     email: M.Hessling@itc.gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 7877
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38. #include <stdio.h>
  39. #include <stdlib.h>
  40.  
  41. #include "the.h"
  42.  
  43. /*#define TRACE*/
  44. /*-------------------------- external data ----------------------------*/
  45. extern VIEW_DETAILS *vd_current,*vd_first;
  46. extern char current_file;                   /* pointer to current file */
  47. extern WINDOW *foot,*error_window;
  48. extern char error_on_screen;
  49. extern unsigned char in_profile;    /* indicates if processing profile */
  50. /***********************************************************************/
  51. #ifdef PROTO
  52. void display_error(unsigned short err_num,unsigned char *mess)
  53. #else
  54. void display_error(err_num,mess)
  55. unsigned short err_num;
  56. unsigned char *mess;
  57. #endif
  58. /***********************************************************************/
  59. {
  60. /*--------------------------- local data ------------------------------*/
  61.  
  62. static char error_message[][80] =
  63. {
  64.  "",
  65.  "Error 0001: Invalid operand: ",
  66.  "Error 0002: Too many operands",
  67.  "Error 0003: Too few operands",
  68.  "Error 0004: Invalid number: ",
  69.  "Error 0005: Numeric operand too small",
  70.  "Error 0006: Numeric operand too large",
  71.  "Error 0007: ",
  72.  "Error 0008: Invalid or protected file",
  73.  "Error 0009: File not found",
  74.  "Error 0010: Path not found",
  75.  "Error 0011: ",
  76.  "Error 0012: ",
  77.  "Error 0013: Invalid key name:",
  78.  "Error 0014: ",
  79.  "Error 0015: ",
  80.  "Error 0016: ",
  81.  "Error 0017: Target not found",
  82.  "Error 0018: ",
  83.  "Error 0019: ",
  84.  "Error 0020: ",
  85.  "Error 0021: Invalid command: ",
  86.  "Error 0022: File has been changed - use QQUIT to really quit",
  87.  "Error 0023: Help file not found",
  88.  "Error 0024: ",
  89.  "Error 0025: Invalid profile command: ",
  90.  "Error 0026: ",
  91.  "Error 0027: ",
  92.  "Error 0028: ",
  93.  "Error 0029: Cannot edit - non-text file:",
  94.  "Error 0030: Memory shortage",
  95.  "Error 0031: File already exists - use FFILE/SSAVE",
  96.  "Error 0032: ",
  97.  "Error 0033: ",
  98.  "Error 0034: ",
  99.  "Error 0035: ",
  100.  "Error 0036: No lines changed",
  101.  "Error 0037: Length of command and parameters exceeds 80",
  102.  "Error 0038: Improper cursor position",
  103.  "Error 0039: No remembered operand available",
  104.  "Error 0040: ",
  105.  "Error 0041: ",
  106.  "Error 0042: ",
  107.  "Error 0043: ",
  108.  "Error 0044: No marked block",
  109.  "Error 0045: ",
  110.  "Error 0046: ",
  111.  "Error 0047: ",
  112.  "Error 0048: ",
  113.  "Error 0049: ",
  114.  "Error 0050: ",
  115.  "Error 0051: ",
  116.  "Error 0052: ",
  117.  "Error 0053: ",
  118.  "Error 0054: ",
  119.  "Error 0055: ",
  120.  "Error 0056: ",
  121.  "Error 0057: ",
  122.  "Error 0058: ",
  123.  "Error 0059: ",
  124.  "Error 0060: ",
  125.  "Error 0061: ",
  126.  "Error 0062: ",
  127.  "Error 0063: ",
  128.  "Error 0064: ",
  129.  "Error 0065: ",
  130.  "Error 0066: Invalid match position",
  131.  "Error 0067: Invalid match character",
  132.  "Error 0068: Matching character not found",
  133.  "Error 0069: Invalid character",
  134.  "Error 0070: ",
  135.  "Error 0071: ",
  136.  "Error 0072: ",
  137.  "Error 0073: ",
  138.  "Error 0074: ",
  139.  "Error 0075: ",
  140.  "Error 0076: ",
  141.  "Error 0077: ",
  142.  "Error 0078: ",
  143.  "Error 0079: ",
  144.  "Error 0080: ",
  145.  "Error 0081: ",
  146.  "Error 0082: ",
  147.  "Error 0083: ",
  148.  "Error 0084: ",
  149.  "Error 0085: Too many files in the ring"
  150. };
  151. unsigned char save_line[80];
  152. unsigned short error_location;
  153. register int i;
  154. /*--------------------------- processing ------------------------------*/
  155. #ifdef TRACE
  156.  trace_function("error.c:   display_error");
  157. #endif
  158.  if (in_profile)
  159.    {
  160.     fprintf(stderr,"%s %s\n",error_message[err_num],mess);
  161. #ifdef TRACE
  162.     trace_return();
  163. #endif
  164.     return;
  165.    }
  166.  
  167.  for (i=0;i<COLS;i++)
  168.     mvwaddch(error_window,0,i,' ');
  169.  wmove(error_window,0,0);
  170.  wprintw(error_window,"%s %s",error_message[err_num],mess);
  171.  wnoutrefresh(error_window);
  172.  error_on_screen = YES;
  173. #ifdef TRACE
  174.  trace_return();
  175. #endif
  176.  return;
  177. }
  178.